package com.icode.core.dto.house;

import com.icode.core.model.house.HouseInfo;
import com.icode.core.model.house.HouseWeek;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 15-4-14
 * Time: 下午4:28
 * To change this template use File | Settings | File Templates.
 */
public class HouseWeekDTO {

    private String guid;
    private String name;
    private String description;
    private String price;
    private String houseBaseArea;
    private String houseInfoGuid;
    private String houseInfoName;

    private String weekReg;
    private String minDate;
    private String maxDate;
    private List<HouseWeekTimeDTO> houseWeekTimeDTOs;

    private int totalNum;
    private int soldNum;

    public HouseWeekDTO() {
    }

    public HouseWeekDTO(String guid, String name, String description, String price, String houseBaseArea, String houseInfoGuid, List<HouseWeekTimeDTO> houseWeekTimeDTOs, String houseInfoName, int totalNum, int soldNum) {
        this.guid = guid;
        this.name = name;
        this.description = description;
        this.price = price;
        this.houseBaseArea = houseBaseArea;
        this.houseInfoGuid = houseInfoGuid;
        this.houseWeekTimeDTOs = houseWeekTimeDTOs;
        this.houseInfoName = houseInfoName;
        this.totalNum = totalNum;
        this.soldNum = soldNum;
    }


    public static HouseWeekDTO toDTO(HouseWeek houseWeek) {
        List<HouseWeekTimeDTO> houseWeekTimeDTOs = HouseWeekTimeDTO.toDTOs(houseWeek.houseWeekTimes());
        HouseInfo houseInfo = houseWeek.houseInfo();
        return new HouseWeekDTO(houseWeek.guid(), houseWeek.name(), houseWeek.description(), houseWeek.price(), houseWeek.houseBaseArea().getLabel(), houseInfo.guid(), houseWeekTimeDTOs, houseInfo.baseInfo().houseName(), houseWeek.totalNum(), houseWeek.soldNum());
    }

    public static List<HouseWeekDTO> toDTOs(List<HouseWeek> houseWeeks) {
        List<HouseWeekDTO> houseWeekDTOs = new ArrayList<>();
        for (HouseWeek h : houseWeeks) {
            HouseWeekDTO houseWeekDTO = toDTO(h);
            houseWeekDTOs.add(houseWeekDTO);
        }
        return houseWeekDTOs;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public void setGuid(String guid) {
        this.guid = guid;
    }

    public String getGuid() {

        return guid;
    }

    public String getName() {
        return name;
    }

    public String getHouseBaseArea() {
        return houseBaseArea;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setHouseBaseArea(String houseBaseArea) {
        this.houseBaseArea = houseBaseArea;
    }

    public String getMinDate() {
        return minDate;
    }

    public void setMinDate(String minDate) {
        this.minDate = minDate;
    }

    public String getMaxDate() {
        return maxDate;
    }

    public void setMaxDate(String maxDate) {
        this.maxDate = maxDate;
    }

    public String getWeekReg() {
        return weekReg;
    }

    public void setWeekReg(String weekReg) {
        this.weekReg = weekReg;
    }

    public String getHouseInfoGuid() {
        return houseInfoGuid;
    }

    public void setHouseInfoGuid(String houseInfoGuid) {
        this.houseInfoGuid = houseInfoGuid;
    }

    public List<HouseWeekTimeDTO> getHouseWeekTimeDTOs() {
        return houseWeekTimeDTOs;
    }

    public void setHouseWeekTimeDTOs(List<HouseWeekTimeDTO> houseWeekTimeDTOs) {
        this.houseWeekTimeDTOs = houseWeekTimeDTOs;
    }

    public String getPrice() {
        return price;
    }

    public int getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(int totalNum) {
        this.totalNum = totalNum;
    }

    public int getSoldNum() {
        return soldNum;
    }

    public void setSoldNum(int soldNum) {
        this.soldNum = soldNum;
    }

    public String getHouseInfoName() {
        return houseInfoName;
    }

    public void setHouseInfoName(String houseInfoName) {
        this.houseInfoName = houseInfoName;
    }
}
